''' 1、添加名片
    2、显示全部
    3、查询名片
    4、推出系统
'''
import json
card_lines = []   # 将字典存入列表


def add_dict(dicts):
    '''将个人字典信息加入列表'''
    card_lines.append(dicts)
    with open('card.json', 'w') as file_obj:
        json.dump(card_lines, file_obj)


def add_card(name, phone, email):
    '''以字典形式存储学生个人信息'''
    cards = {'name': name, 'phone': phone, 'email': email}
    add_dict(cards)


def card_show():
    '''展示名片'''
    with open('card.json') as file_obj:
        lines = json.load(file_obj)
    print('-' * 50)
    print('   ' + '姓名' + '           ' + '电话' + '           ' + '邮箱')
    for i in range(0, len(lines)):
        print('   ' + lines[i]['name'] + '           ' + lines[i]['phone']
              + '           ' + lines[i]['email'])
    print('-'*50)


def hello():
    print('-' * 50)
    print("欢迎使用名片管理系统")
    function_cards = ['1、添加名片', '2、显示全部', '3、查询名片', '4、推出系统']
    for function_card in function_cards:
        print('    '+function_card)
    print('-' * 50)


def wait():
    while True:
        pass

